import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { AlarmInfoVO, AlarmInfoForm, AlarmInfoQuery } from '@/api/device/alarmInfo/types';

/**
 * 查询报警信息列表
 * @param query
 * @returns {*}
 */

export const listAlarmInfo = (query?: AlarmInfoQuery): AxiosPromise<AlarmInfoVO[]> => {
  return request({
    url: '/system/alarmInfo/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询报警信息详细
 * @param id
 */
export const getAlarmInfo = (id: string | number): AxiosPromise<AlarmInfoVO> => {
  return request({
    url: '/system/alarmInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增报警信息
 * @param data
 */
export const addAlarmInfo = (data: AlarmInfoForm) => {
  return request({
    url: '/system/alarmInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改报警信息
 * @param data
 */
export const updateAlarmInfo = (data: AlarmInfoForm) => {
  return request({
    url: '/system/alarmInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除报警信息
 * @param id
 */
export const delAlarmInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/alarmInfo/' + id,
    method: 'delete'
  });
};

export const alarmInfoConfirm = (data: any) => {
  return request({
    url: '/system/alarmInfo/confirm',
    method: 'post',
    data: data
  });
};

export const alarmInfoHandle = (data: any) => {
  return request({
    url: '/system/alarmInfo/handle',
    method: 'post',
    data: data
  });
};
